<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!-- saved from url=(0080)http://www.whizlabs.com/examprep/mod/quiz/review.php?attempt=170040&showall=true -->
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en" xml:lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
<link rel="stylesheet" type="text/css" href="./Basic Stuff Sucks_files/styles.php">
<link rel="stylesheet" type="text/css" href="./Basic Stuff Sucks_files/styles(1).php">

<!--[if IE 7]>
    <link rel="stylesheet" type="text/css" href="http://www.whizlabs.com/examprep/theme/standard/styles_ie7.css" />
<![endif]-->
<!--[if IE 6]>
    <link rel="stylesheet" type="text/css" href="http://www.whizlabs.com/examprep/theme/standard/styles_ie6.css" />
<![endif]-->


    <meta name="keywords" content="moodle, OCPJP 6 - Exam Simulator: Basic Stuff Sucks ">
    <title>OCPJP 6 - Exam Simulator: Basic Stuff Sucks</title>
    <link rel="shortcut icon" href="http://www.whizlabs.com/examprep/theme/ability-to-learn/favicon.ico">
    <!--<style type="text/css">/*<![CDATA[*/ body{behavior:url(http://www.whizlabs.com/examprep/lib/csshover.htc);} /*]]>*/</style>-->

<script type="text/javascript" src="./Basic Stuff Sucks_files/javascript-static.js"></script>
<script type="text/javascript" src="./Basic Stuff Sucks_files/javascript-mod.php"></script>
<script type="text/javascript" src="./Basic Stuff Sucks_files/overlib.js"></script>
<script type="text/javascript" src="./Basic Stuff Sucks_files/overlib_cssstyle.js"></script>
<script type="text/javascript" src="./Basic Stuff Sucks_files/cookies.js"></script>
<script type="text/javascript" src="./Basic Stuff Sucks_files/ufo.js"></script>
<script type="text/javascript" src="./Basic Stuff Sucks_files/dropdown.js"></script>  

<script type="text/javascript" defer="defer">
//<![CDATA[
setTimeout('fix_column_widths()', 20);
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
function openpopup(url,name,options,fullscreen) {
  fullurl = "http://www.whizlabs.com/examprep" + url;
  windowobj = window.open(fullurl,name,options);
  if (fullscreen) {
     windowobj.moveTo(0,0);
     windowobj.resizeTo(screen.availWidth,screen.availHeight);
  }
  windowobj.focus();
  return false;
}

function uncheckall() {
  void(d=document);
  void(el=d.getElementsByTagName('INPUT'));
  for(i=0;i<el.length;i++) {
    void(el[i].checked=0);
  }
}

function checkall() {
  void(d=document);
  void(el=d.getElementsByTagName('INPUT'));
  for(i=0;i<el.length;i++) {
    void(el[i].checked=1);
  }
}

function inserttext(text) {
  text = ' ' + text + ' ';
  if ( opener.document.forms['theform'].message.createTextRange && opener.document.forms['theform'].message.caretPos) {
    var caretPos = opener.document.forms['theform'].message.caretPos;
    caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
  } else {
    opener.document.forms['theform'].message.value  += text;
  }
  opener.document.forms['theform'].message.focus();
}

function getElementsByClassName(oElm, strTagName, oClassNames){
	var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
	var arrReturnElements = new Array();
	var arrRegExpClassNames = new Array();
	if(typeof oClassNames == "object"){
		for(var i=0; i<oClassNames.length; i++){
			arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
		}
	}
	else{
		arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
	}
	var oElement;
	var bMatchesAll;
	for(var j=0; j<arrElements.length; j++){
		oElement = arrElements[j];
		bMatchesAll = true;
		for(var k=0; k<arrRegExpClassNames.length; k++){
			if(!arrRegExpClassNames[k].test(oElement.className)){
				bMatchesAll = false;
				break;
			}
		}
		if(bMatchesAll){
			arrReturnElements.push(oElement);
		}
	}
	return (arrReturnElements)
}
//]]>
</script>
    
		<style type="text/css">
	<!--
	#main {
		min-height: 500px;
		width: 988px;
		margin: auto;
		background:#fff;
	}
	#header {
		height: 90px;
		width: 988px;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/header.gif);
	}
	#navi {
		float: left;
		height: 22px;
		width: 828px;
		padding: 10px 0pt 0pt 20px;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-up_02.gif);
	}
	#navi2 {
		height: 32px;
		width: 140px;
		float: left;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/part3left.gif);
		text-align: left;
	}
	#left {
		float: left;
		min-height: 675px;
		width: 263px;
	}
	
	#leftinsertdiv {
		float: left;
		height: 58px;
		width: 263px;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-left-down_04.gif);
	}
	
	#left3 {
		float: left;
		height: 617px;
		width: 21px;
		/*background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-up_05.gif);*/
	}
	
	#left4 {
		height: 58px;
		width: 242px;
		float: right;
	}
	#left5 {
		float: right;
		height: 62px;
		width: 242px;
	}
	#left6 {
		float: right;
		min-height: 160px;
		width: 242px;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-up_06-19.gif);
	}
	#right {
		float: left;
		min-height: 601px;
		width: 725px;
		background:#fff;
	}
	#leftfooter {
		float: left;
		height: 159px;
		width: 263px;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/footerdiv.gif);
		background-repeat:no-repeat;
	}
	#rightfooter {
		float: left;
		height: 50px;
		width: 725px;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-up_10-53.gif);
		background-position:left bottom;
		background-repeat:no-repeat;
		padding-top:90px;
		background-color:#fff;
	}
	#rightfooter2 {
		float: left;
		height: 19px;
		width: 725px;
		background-image: url(http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-up_54.gif);
	}
	-->
	</style>
	
<link href="./Basic Stuff Sucks_files/css.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

<script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/document_iterator.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/find_proxy.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/get_html_text.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/global_constants.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/name_injection_builder.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/number_injection_builder.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/string_finder.js"></script><script src="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/change_sink.js"></script><meta name="document_iterator.js"><meta name="find_proxy.js"><meta name="get_html_text.js"><meta name="global_constants.js"><meta name="name_injection_builder.js"><meta name="number_injection_builder.js"><meta name="string_finder.js"><meta name="change_sink.js"><style charset="utf-8" type="text/css" id="">SPAN.skype_pnh_container SPAN.skype_pnh_mark{  display:none !important;}@media screen{SPAN.skype_pnh_print_container_1323210120{  display:none !important;}SPAN.skype_pnh_container, SPAN.skype_pnh_container *{background-attachment: scroll !important;background-color: transparent !important;background-image: none !important;background-position: 0px 0px ! important;background-repeat: no-repeat !important;border: 0px none !important;border-color: #000000 !important;border-style: none !important;border-width: 0 !important;border-left: 0 none #000000 !important;border-top: 0 none #000000 !important;border-right: 0 none #000000 !important;border-bottom: 0 none #000000 !important;border-left-color: #000000 !important;border-left-style: none !important;border-left-width: 0 !important;border-top-color: #000000 !important;border-top-style: none !important;border-top-width: 0 !important;border-right-color: #000000 !important;border-right-style: none !important;border-right-width: 0 !important;border-bottom-color: #000000 !important;border-bottom-style: none !important;border-bottom-width: 0 !important;border-collapse: separate !important;bottom: auto !important;clear: none !important;clip: auto !important;cursor: pointer !important;direction: ltr !important;display: inline !important;float: none !important;font-style: normal !important;left: auto !important;letter-spacing: 0 !important;list-style-image: none !important;list-style-position: outside !important;list-style-type: disc !important;overflow: hidden !important;overflow-x: hidden !important;overflow-y: hidden !important;padding: 0px 0px 0px 0px !important;padding-left: 0px !important;padding-top: 0px !important;padding-right: 0px !important;padding-bottom: 0px !important;page-break-after: auto !important;page-break-before: auto !important;page-break-inside: auto !important;position: static !important;right: auto !important;table-layout: auto !important;text-align: left !important;text-decoration: none !important;text-indent: 0px !important;text-transform: none !important;top: auto !important;voice-family: inherit !important;white-space: nowrap !important;word-spacing: normal !important;z-index: 0 !important;  color: #49535A !important;  font-family: Tahoma, Arial, Helvetica, sans-serif !important;  font-size: 11px !important;  font-weight: bold !important;  height: 14px !important;  line-height: 14px !important;  margin-left: 0px !important;  margin-top: 0px !important;  margin-right: 0px !important;  margin-bottom: 0px !important;  vertical-align: baseline !important;  width: auto !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_active_fax SPAN.skype_pnh_right_span, SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_inactive_fax SPAN.skype_pnh_right_span{  background-position: -92px 0px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_inactive_free SPAN.skype_pnh_dropart_flag_span{  background-position: 0px 1px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_inactive_free SPAN.skype_pnh_textarea_span{  background-position: -90px 0px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_inactive_free SPAN.skype_pnh_text_span{  visibility: hidden !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_active_free SPAN.skype_pnh_dropart_flag_span{  background-position: 0px 1px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_active_free SPAN.skype_pnh_textarea_span{  background-position: -160px 0px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_active_free SPAN.skype_pnh_text_span{  background-position: -160px 0px !important;  color: #FFFFFF !important;}SPAN.skype_pnh_container SPAN.skype_pnh_left_span{  background-position: 0px 0px !important;  width: 6px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_dropart_span{  background-position: -11px 0px !important;  width: 27px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_dropart_wo_arrow_span{  background-position: -130px 0px !important;  width: 18px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_dropart_flag_span{  background-position: 1px 1px !important;  width: 18px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_textarea_span{  background-position: -125px 0px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_text_span{  padding-left: 5px !important;  background-position: -125px 0px !important;}SPAN.skype_pnh_container SPAN.skype_pnh_right_span{  background-position: -62px 0px !important;  width: 15px !important;}}@media print{SPAN.skype_pnh_print_container_1323210120{}SPAN.skype_pnh_container{    display:none !important;}}@media screen{SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_inactive_common *{  background-image:url('chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/numbers_common_inactive_icon_set.gif') !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_active_common *{  background-image:url('chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/numbers_common_active_icon_set.gif') !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_inactive_fax *{  background-image:url('chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/numbers_common_inactive_icon_set.gif') !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_active_fax *{  background-image:url('chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/numbers_common_active_icon_set.gif') !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_inactive_free *{  background-image:url('chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/numbers_free_icon_set.gif') !important;}SPAN.skype_pnh_container SPAN.skype_pnh_highlighting_active_free *{  background-image:url('chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/numbers_free_icon_set.gif') !important;}SPAN.skype_pnh_container SPAN.skype_pnh_dropart_flag_span{  background-image: url('chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl/flags.gif') !important;}}</style></head>
<!-- WANT URL-->

<body class="mod-quiz course-11 dir-ltr lang-en_utf8" id="mod-quiz-review" onload="MM_preloadImages(&#39;http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-up_07.gif&#39;,&#39;http://www.whizlabs.com/examprep/theme/ability-to-learn/images/psd-over_05.gif&#39;);">


<div id="main">
  <div id="header"><br>
    <p class="headertxt">Call Us at <span class="skype_pnh_print_container_1323210120">+1-818-575-6625</span><span class="skype_pnh_container" dir="ltr" tabindex="-1"><span class="skype_pnh_mark"> begin_of_the_skype_highlighting</span>&nbsp;<span class="skype_pnh_highlighting_inactive_common" dir="ltr" skypeaction="skype_dropdown" title="Call this phone number in United States of America with Skype: +18185756625"><span class="skype_pnh_left_span" skypeaction="skype_dropdown" title="Skype actions">&nbsp;&nbsp;</span><span class="skype_pnh_dropart_span" skypeaction="skype_dropdown" title="Skype actions"><span class="skype_pnh_dropart_flag_span" skypeaction="skype_dropdown" style="background-position: -5849px 1px !important; ">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>&nbsp;&nbsp;&nbsp;</span><span class="skype_pnh_textarea_span"><span class="skype_pnh_text_span">+1-818-575-6625</span></span><span class="skype_pnh_right_span">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></span>&nbsp;<span class="skype_pnh_mark">end_of_the_skype_highlighting</span></span> | <a href="http://www.whizlabs.com/examprep/login/logout.php?sesskey=T5WndyyTDm">Sign Out</a> | <a href="http://www.whizlabs.com/index.php?option=com_whizmart&view=cart">My Cart</a> | <a href="http://www.whizlabs.com/examprep/user/view.php">Change Password</a></p>
    <p class="txtheader">Welcome <a href="http://www.whizlabs.com/examprep">Flavio&nbsp;Vit !</a></p>
  </div>


  <div id="navi" class="breadcrumb"><h2 class="accesshide ">You are here</h2> <ul>
<li class="first"><a onclick="this.target=&#39;_top&#39;" href="http://www.whizlabs.com/">Home</a></li><li class="first"> <span class="accesshide ">/&nbsp;</span><span class="arrow sep">»</span> <a onclick="this.target=&#39;_top&#39;" href="http://www.whizlabs.com/examprep/">My Account</a></li><li class="first"> <span class="accesshide ">/&nbsp;</span><span class="arrow sep">»</span> <a onclick="this.target=&#39;_top&#39;" href="http://www.whizlabs.com/examprep/course/view.php?id=11">OCPJP 6 - Exam Simulator</a></li><li class="first"> <span class="accesshide ">/&nbsp;</span><span class="arrow sep">»</span> <a onclick="this.target=&#39;_top&#39;" href="http://www.whizlabs.com/examprep/mod/quiz/view.php?id=2545">Basic Stuff Sucks</a></li><li class="first"> <span class="accesshide ">/&nbsp;</span><span class="arrow sep">»</span> Review of attempt 1</li></ul>			<div class="navbutton">
				</div>  
  
  <div style="float:right; margin-right:60px;font-size:12px; font-weight:bold; color:#0460AD;">
  	</div>
  </div>

  <div id="navi2">
  <a href="http://www.whizlabs.com/examprep/eddy_report/performance_trak.php?cid=11" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage(&#39;Image1&#39;,&#39;&#39;,&#39;http://www.whizlabs.com/examprep/theme/ability-to-learn/images/layerrollov.gif&#39;,1)"><img src="./Basic Stuff Sucks_files/performace_history.gif" name="Image1" width="125" height="32" border="0" id="Image1"></a></div>
    <!-- END OF HEADER -->
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div><h2 class="main">Basic Stuff Sucks</h2><h2 class="main">Review of attempt 1</h2>




<div class="controls">
<div class="singlebutton"><form action="http://www.whizlabs.com/examprep/mod/quiz/view.php" method="get"><div><input type="hidden" name="id" value="2545"><input type="submit" value="Finish review"></div></form></div></div>
<table class="generaltable generalbox quizreviewsummary"><tbody>
<tr><th scope="row" class="cell">Started on</th><td class="cell">Monday,  12 December 2011, 03:18 PM</td></tr>
<tr><th scope="row" class="cell">Completed on</th><td class="cell">Monday,  12 December 2011, 04:02 PM</td></tr>
<tr><th scope="row" class="cell">Time taken</th><td class="cell">43 mins 46 secs</td></tr>
<tr><th scope="row" class="cell">Grade</th><td class="cell"><b>12.5</b> out of a maximum of 20 (<b>63</b>%)</td></tr>
</tbody></table>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%201%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5361" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                1      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of compiling and running the following code?<br> <br>abstract class AbstractTest<br>{ <br><div style="margin-left: 40px;">static int i;<br> abstract Object test();<br> AbstractTest()<br>{ <br><div style="margin-left: 40px;">System.out.println("A"); <br></div>}<br></div> } <br><br>class Test extends AbstractTest<br>{<br><div style="margin-left: 40px;"> Integer test()<br>{<br><div style="margin-left: 40px;"> return i; <br></div>} <br></div><div style="margin-left: 40px;"><br>public static void main(String[] args)<br>{ <br><div style="margin-left: 40px;">Test t=new Test();<br> System.out.println(t.test());<br></div> } <br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5361_22817" name="resp5361_" checked="checked" type="radio" value="22817">        </td>
        <td class="c1 text ">
          <label for="resp5361_22817">
            <span class="anun">a<span class="anumsep">.</span></span> Compiler error            <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5361_22818" name="resp5361_" type="radio" value="22818">        </td>
        <td class="c1 text correct">
          <label for="resp5361_22818">
            <span class="anun">b<span class="anumsep">.</span></span> Prints "A" followed by 0            <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5361_22819" name="resp5361_" type="radio" value="22819">        </td>
        <td class="c1 text ">
          <label for="resp5361_22819">
            <span class="anun">c<span class="anumsep">.</span></span> Prints 0            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5361_22820" name="resp5361_" type="radio" value="22820">        </td>
        <td class="c1 text ">
          <label for="resp5361_22820">
            <span class="anun">d<span class="anumsep">.</span></span> None of these            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice B is the correct answer.<br><br> The test method in the Test class demonstrates the use of covariant return types i.e., the return type of the overriding method is a subclass of the return type of the overridden method, here Integer is the subclass of Object. When the Test class is instantiated, the default subclass constructor invokes the superclass constructor, so "A" is printed. So choice C is incorrect. <br><br>Static variables are automatically initialized to 0, and may be accessed from non-static methods. So 0 is also printed. <br><br>Since there are no compiler errors or exceptions in this code, choices A and D are also incorrect.      </div>
        <div class="grading">
      <div class="correctness  incorrect">Incorrect</div><div class="gradingdetails">Marks for this submission: 0/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%202%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5243" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                2      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of compiling and running the following program? (Assume that the command line arguments 0, 1, and 2 are passed to it) <br><br>class VarArgTest <br>{ <br>
<div style="margin-left: 40px;"> public static void f(String... a)<br> { <br>
  <div style="margin-left: 40px;"> for(String i : a)<br>
    <div style="margin-left: 40px;"> System.out.print("A"+i); <br></div></div> } <br> public static void f(String[] a)<br> { <br>
  <div style="margin-left: 40px;"> for(String i : a) <br>
    <div style="margin-left: 40px;"> System.out.print("B"+i); <br></div></div> } <br> public static void main(String[] args)<br> { <br>
  <div style="margin-left: 40px;"> f(args); <br></div> } <br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5243_22254" name="resp5243_" type="radio" value="22254">        </td>
        <td class="c1 text correct">
          <label for="resp5243_22254">
            <span class="anun">a<span class="anumsep">.</span></span> Compiler Error            <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5243_22255" name="resp5243_" type="radio" value="22255">        </td>
        <td class="c1 text ">
          <label for="resp5243_22255">
            <span class="anun">b<span class="anumsep">.</span></span> Exception at runtime            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5243_22256" name="resp5243_" type="radio" value="22256">        </td>
        <td class="c1 text ">
          <label for="resp5243_22256">
            <span class="anun">c<span class="anumsep">.</span></span> Prints "A0A1A2"            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5243_22257" name="resp5243_" checked="checked" type="radio" value="22257">        </td>
        <td class="c1 text ">
          <label for="resp5243_22257">
            <span class="anun">d<span class="anumsep">.</span></span> Prints "B0B1B2"            <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5243_22258" name="resp5243_" type="radio" value="22258">        </td>
        <td class="c1 text ">
          <label for="resp5243_22258">
            <span class="anun">e<span class="anumsep">.</span></span> None of these            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice A is the correct answer.<br><br> The code does not compile because the method call made matches with both the methods in the class. Variable arguments (varargs) allow you to specify that a method can take multiple arguments of the same type and don't require that the number of arguments be predetermined. <br><br>A method can have at most one parameter that is a vararg, it must be the last parameter taken by the method, and it is denoted by the object type, a set of ellipses ( ... ), and the name of the variable. <br><br>When you specify a variable-length argument list, it is read as "create an array of type &lt;type of varargs&gt;". So the two methods in this class are equivalent, which causes ambiguity for the compiler. Since the program does not compile, the other choices are automatically incorrect. <br><br>Refer to <a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html">http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html</a> for more on how to use varargs.      </div>
        <div class="grading">
      <div class="correctness  incorrect">Incorrect</div><div class="gradingdetails">Marks for this submission: 0/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%203%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5420" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                3      </div>
      </div>
  <div class="content">
    <div class="qtext">
  Which of the following import statements are legal? Select two choices.<br></div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose at least one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5420_23091" name="resp5420_23091" type="checkbox" value="23091">        </td>
        <td class="c1 text ">
          <label for="resp5420_23091">
            <span class="anun">a<span class="anumsep">.</span></span> import java.lang;            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5420_23092" name="resp5420_23092" type="checkbox" value="23092">        </td>
        <td class="c1 text ">
          <label for="resp5420_23092">
            <span class="anun">b<span class="anumsep">.</span></span> static import java.lang.Math;            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5420_23093" name="resp5420_23093" checked="checked" type="checkbox" value="23093">        </td>
        <td class="c1 text correct">
          <label for="resp5420_23093">
            <span class="anun">c<span class="anumsep">.</span></span> import java.lang.Math;            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5420_23094" name="resp5420_23094" checked="checked" type="checkbox" value="23094">        </td>
        <td class="c1 text correct">
          <label for="resp5420_23094">
            <span class="anun">d<span class="anumsep">.</span></span> import static java.lang.Math.*;            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5420_23095" name="resp5420_23095" type="checkbox" value="23095">        </td>
        <td class="c1 text ">
          <label for="resp5420_23095">
            <span class="anun">e<span class="anumsep">.</span></span> static import java.lang.Math.*;            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choices C and D are the correct answers.<br><br> The static import construct allows unqualified access to static members without inheriting from the type containing the static members. <br><br>Whereas the normal import declaration imports classes from packages, allowing them to be used without package qualification, the static import declaration imports static members from classes, allowing them to be used without class qualification. <br><br>Choice C is correct because it imports the Math class correctly. <br><br>Choice D is correct because it imports the static members of Math class correctly. <br><br>Choice A is incorrect because you can only import classes or interfaces from a package, and not the package itself. <br><br>Choices B and E are incorrect because the static keyword must follow the import keyword in a static import. <br><br>To know more about static imports, refer to <br><a href="http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.3">http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.3</a><br><a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html"> http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html</a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%204%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5277" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                4      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What will be the result of attempting to compile and run the following program? <br><br>class Test <br>{ <br>
<div style="margin-left: 40px;">public static void main(String[] args) <br>{ <br>
  <div style="margin-left: 40px;">int[] i = {1,2,3,4,5}; <br>float[] j = new float[5]; <br>for (int k=0;k &lt; j.length(); k++) <br>{ <br>
    <div style="margin-left: 40px;">i[k] = (char)j[k]; <br>System.out.println(i[k]); <br></div>} <br></div>} <br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5277_22423" name="resp5277_" type="radio" value="22423">        </td>
        <td class="c1 text ">
          <label for="resp5277_22423">
            <span class="anun">a<span class="anumsep">.</span></span> Compiler error - char cannot be assigned to int            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5277_22424" name="resp5277_" checked="checked" type="radio" value="22424">        </td>
        <td class="c1 text ">
          <label for="resp5277_22424">
            <span class="anun">b<span class="anumsep">.</span></span> Compiler error - Array j is not initialized            <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5277_22425" name="resp5277_" type="radio" value="22425">        </td>
        <td class="c1 text ">
          <label for="resp5277_22425">
            <span class="anun">c<span class="anumsep">.</span></span> ArrayIndexOutOfBoundsException at runtime            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5277_22426" name="resp5277_" type="radio" value="22426">        </td>
        <td class="c1 text ">
          <label for="resp5277_22426">
            <span class="anun">d<span class="anumsep">.</span></span> Prints 0 five times            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5277_22427" name="resp5277_" type="radio" value="22427">        </td>
        <td class="c1 text ">
          <label for="resp5277_22427">
            <span class="anun">e<span class="anumsep">.</span></span> Prints 0.0 five times            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5277_22428" name="resp5277_" type="radio" value="22428">        </td>
        <td class="c1 text correct">
          <label for="resp5277_22428">
            <span class="anun">f<span class="anumsep">.</span></span> None of the above            <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice F is the correct answer. <br><br>This program does cause a compiler error. The reason for the error is that you are invoking a length() method on an array. Arrays have an instance variable named length, but no method by that name. Apart from this, there are no other errors in this program. char can be assigned to int, the ASCII value of a character variable can be assigned to an integer variable. <br><br>The elements of array j are initialized to 0.0, once it is created. Thus, choices A and B do not apply. <br><br>If length had been accessed as an instance variable instead of a method, it would have printed 0 five times. <br><br>More information about arrays is available at <a href="http://java.sun.com/docs/books/jls/third_edition/html/arrays.html">http://java.sun.com/docs/books/jls/third_edition/html/arrays.html</a>      </div>
        <div class="grading">
      <div class="correctness  incorrect">Incorrect</div><div class="gradingdetails">Marks for this submission: 0/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%205%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5208" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                5      </div>
      </div>
  <div class="content">
    <div class="qtext">
  Which of the following statements about StringBuilder are true? Select two choices.<br></div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose at least one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5208_22073" name="resp5208_22073" type="checkbox" value="22073">        </td>
        <td class="c1 text ">
          <label for="resp5208_22073">
            <span class="anun">a<span class="anumsep">.</span></span> It has inherent thread protection.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5208_22074" name="resp5208_22074" checked="checked" type="checkbox" value="22074">        </td>
        <td class="c1 text correct">
          <label for="resp5208_22074">
            <span class="anun">b<span class="anumsep">.</span></span> It is faster than StringBuffer.            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5208_22075" name="resp5208_22075" checked="checked" type="checkbox" value="22075">        </td>
        <td class="c1 text correct">
          <label for="resp5208_22075">
            <span class="anun">c<span class="anumsep">.</span></span> It defines the append and insert methods.            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5208_22076" name="resp5208_22076" type="checkbox" value="22076">        </td>
        <td class="c1 text ">
          <label for="resp5208_22076">
            <span class="anun">d<span class="anumsep">.</span></span> It is immutable.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choices B and C are the correct answers. <br><br>StringBuilder represents a mutable sequence of characters. Even though it is similar to StringBuffer in most aspects, they both differ on the thread protection aspect. <br><br>StringBuilder instances are not safe for use by multiple threads, while StringBuffer instances have inherent thread protection. This makes StringBuilder faster than StringBuffer. So choice A is incorrect while choice B is correct. <br><br>Both StringBuilder and StringBuffer classes define the append and insert methods, so choice C is also correct.<br><br> Since StringBuilder is mutable, choice D is incorrect. <br>For more information, you may refer to <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html">http://java.sun.com/j2se/1.5.0/docs/api/java/lang/StringBuilder.html</a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%206%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5356" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                6      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of compiling and executing the following code ? <br><br>class MyBoolean <br>{ <br>
<div style="margin-left: 40px;">Boolean[] bool = new Boolean[5];<br> <br>public static void main(String[] args) <br>{ <br>
  <div style="margin-left: 40px;">new MyBoolean().myMethod();<br></div> }<br> <br>public void myMethod()<br> { <br>
  <div style="margin-left: 40px;">if(bool[1]==true) <br>{<br>
    <div style="margin-left: 40px;"> System.out.println("It's true");<br></div> }<br> else <br>{ <br>
    <div style="margin-left: 40px;">System.out.println("It's false");<br></div></div>
  <div style="margin-left: 40px;"> }<br></div> }<br></div> }</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5356_22793" name="resp5356_" type="radio" value="22793">        </td>
        <td class="c1 text ">
          <label for="resp5356_22793">
            <span class="anun">a<span class="anumsep">.</span></span> Prints: "It's true"            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5356_22794" name="resp5356_" checked="checked" type="radio" value="22794">        </td>
        <td class="c1 text ">
          <label for="resp5356_22794">
            <span class="anun">b<span class="anumsep">.</span></span> Prints: "It's false"            <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5356_22795" name="resp5356_" type="radio" value="22795">        </td>
        <td class="c1 text ">
          <label for="resp5356_22795">
            <span class="anun">c<span class="anumsep">.</span></span> Compile time error            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5356_22796" name="resp5356_" type="radio" value="22796">        </td>
        <td class="c1 text correct">
          <label for="resp5356_22796">
            <span class="anun">d<span class="anumsep">.</span></span> Exception            <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5356_22797" name="resp5356_" type="radio" value="22797">        </td>
        <td class="c1 text ">
          <label for="resp5356_22797">
            <span class="anun">e<span class="anumsep">.</span></span> None of the above            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice D is the correct answer.<br><br> Array elements are initialized to default values when an array is created. For objects, the default value is null. So all the elements of the array bool contain null values. <br><br>Comparing a Boolean with a boolean will result in an autoboxing operation. Since the Boolean object is null, autoboxing a null will cause a NullPointerException to be thrown. Since there is no compiler error in this code, choice C is incorrect. <br><br>Choices A and B are incorrect because the exception occurs before anything is printed.      </div>
        <div class="grading">
      <div class="correctness  incorrect">Incorrect</div><div class="gradingdetails">Marks for this submission: 0/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%207%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q10619" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                7      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of compiling and running the following code? <br><br>class Vararg6 <br>{<br>
<div style="margin-left: 40px">public static void main(String[] args)<br>{<br>
  <div style="margin-left: 40px">callMe(5); // line 1 <br>callMe(); // line 2 <br></div>}<br>static void callMe(byte b)<br>{ <br>
  <div style="margin-left: 40px">System.out.print("byte"); <br></div>}<br>static void callMe(int... b)<br>{<br>
  <div style="margin-left: 40px">System.out.print("int"); <br></div>}<br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp10619_50271" name="resp10619_" type="radio" value="50271">        </td>
        <td class="c1 text ">
          <label for="resp10619_50271">
            <span class="anun">a<span class="anumsep">.</span></span> Compiler error at line 1            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp10619_50272" name="resp10619_" type="radio" value="50272">        </td>
        <td class="c1 text ">
          <label for="resp10619_50272">
            <span class="anun">b<span class="anumsep">.</span></span> Compiler error at line 2            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp10619_50273" name="resp10619_" type="radio" value="50273">        </td>
        <td class="c1 text ">
          <label for="resp10619_50273">
            <span class="anun">c<span class="anumsep">.</span></span> Prints byteint            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp10619_50274" name="resp10619_" checked="checked" type="radio" value="50274">        </td>
        <td class="c1 text correct">
          <label for="resp10619_50274">
            <span class="anun">d<span class="anumsep">.</span></span> Prints intint            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice D is the correct answer.<br><br>The variable arguments (varargs) feature allows a method to be called with zero or more arguments. <br><br>Here the callMe(int... b) method declares b as a variable argument. So it can be invoked by any of the following calls. <br><br>
<div style="margin-left: 40px">callMe() <br>callMe(x1,x2....xn) // where x1, x2, ...xn are of type int <br>callMe(x) // where x is of type int or int[]<br></div><br>Here, we have a callMe method that takes a byte argument also. When we invoke callMe(5), this method is not called because the default type of 5 is taken as int. <br><br>So both calls in the code will cause the varargs version to be invoked. Thus, the output is "intint".<br><br>Reference: <a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html">http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html</a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%208%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5495" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                8      </div>
      </div>
  <div class="content">
    <div class="qtext">
  class ABC<br>{<br>
<div style="margin-left: 40px;"> static int[] arr1;<br> int[] arr2=new int[10]; <br>static float[] arr3={}; <br>void f()<br>{ <br></div>
<div style="margin-left: 80px;">double[] arr4; <br></div>
<div style="margin-left: 40px;">}<br></div> } <br><br>Which of the following are true about the above code? Select three choices.<br></div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose at least one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5495_23456" name="resp5495_23456" checked="checked" type="checkbox" value="23456">        </td>
        <td class="c1 text correct">
          <label for="resp5495_23456">
            <span class="anun">a<span class="anumsep">.</span></span> arr1 is initialized to null            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5495_23457" name="resp5495_23457" checked="checked" type="checkbox" value="23457">        </td>
        <td class="c1 text ">
          <label for="resp5495_23457">
            <span class="anun">b<span class="anumsep">.</span></span> arr4 is initialized to null            <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5495_23458" name="resp5495_23458" checked="checked" type="checkbox" value="23458">        </td>
        <td class="c1 text correct">
          <label for="resp5495_23458">
            <span class="anun">c<span class="anumsep">.</span></span> arr3.length==0            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5495_23459" name="resp5495_23459" type="checkbox" value="23459">        </td>
        <td class="c1 text ">
          <label for="resp5495_23459">
            <span class="anun">d<span class="anumsep">.</span></span> arr2.length==9            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5495_23460" name="resp5495_23460" type="checkbox" value="23460">        </td>
        <td class="c1 text correct">
          <label for="resp5495_23460">
            <span class="anun">e<span class="anumsep">.</span></span> arr2[0]==0            <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choices A, C and E are the correct answers.<br><br> Arrays declared as instance or static variables are initialized to null if they have not been explicitly initialized. So choice A is correct. <br><br>arr3 is initialized to an empty array, which means its length is 0, that is why choice C is also correct. <br><br>Since arr2 is initialized to an array of 10 elements, the length is 10 and not 9. This makes choice D incorrect. <br><br>Choice E is correct because each element is initialized to the default value for int, which is 0. <br><br>arr4 is not initialized to null since local variables are not implicitly initialized. So choice B is incorrect. <br><br>More about arrays is available at: <br><a href="http://java.sun.com/docs/books/jls/third_edition/html/arrays.html">http://java.sun.com/docs/books/jls/third_edition/html/arrays.html</a>      </div>
        <div class="grading">
      <div class="correctness  incorrect">Incorrect</div><div class="gradingdetails">Marks for this submission: 0/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%209%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q10617" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                9      </div>
      </div>
  <div class="content">
    <div class="qtext">
  Which of the following statements about the following code are true? Select two choices. <br><br>package com.name; <br>interface XYZ <br>{<br>
<div style="margin-left: 40px;"> double a = 2; <br></div>} <br>class A{}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose at least one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp10617_50262" name="resp10617_50262" type="checkbox" value="50262">        </td>
        <td class="c1 text ">
          <label for="resp10617_50262">
            <span class="anun">a<span class="anumsep">.</span></span> The variable "a" can be accessed in class A only if class A implements XYZ.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp10617_50263" name="resp10617_50263" checked="checked" type="checkbox" value="50263">        </td>
        <td class="c1 text correct">
          <label for="resp10617_50263">
            <span class="anun">b<span class="anumsep">.</span></span> The variable "a" can be accessed in class A by using a static import.            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp10617_50264" name="resp10617_50264" type="checkbox" value="50264">        </td>
        <td class="c1 text ">
          <label for="resp10617_50264">
            <span class="anun">c<span class="anumsep">.</span></span> The variable "a" can be modified in class A.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp10617_50265" name="resp10617_50265" checked="checked" type="checkbox" value="50265">        </td>
        <td class="c1 text correct">
          <label for="resp10617_50265">
            <span class="anun">d<span class="anumsep">.</span></span> The variable "a" cannot be modified in class A.            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choices B and D are the correct answers.<br><br> The variables declared in an interface are implicitly public, static, and final. The static import feature enables you to import static members from a class or an interface. So we can statically import the members of the interface XYZ by using the statement - import static com.name.XYZ.* <br><br>However, this variable's value cannot be modified in the class because the variable is final. So choice C is incorrect. <br><br>Before the feature of static imports was introduced, a class had to implement an interface to access its members. However, this is no longer true, so choice A is now incorrect. <be><br><br>To know more about static imports, refer to <br><a href="http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.3">http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.3</a><br> <a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html">http://java.sun.com/j2se/1.5.0/docs/guide/language/static-import.html</a></be>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2010%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5239" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                10      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What will happen when the following code is compiled and run? <br><br>1. public class MyClass <br>2. { <br>3.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int maxElements; <br>4. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;void MyClass() <br>5. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>6. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;maxElements = 100;<br> 7. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(maxElements); <br>8. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br>9.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public MyClass(int i) <br>10. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>11.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxElements = i;<br> 12. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(maxElements); <br>13. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br>14. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public static void main(String[] args) <br>15. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ <br>16. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyClass a = new MyClass(); <br>17. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MyClass b = new MyClass(999); <br>18. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} <br>19. }</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5239_22237" name="resp5239_" type="radio" value="22237">        </td>
        <td class="c1 text ">
          <label for="resp5239_22237">
            <span class="anun">a<span class="anumsep">.</span></span> Prints 100 followed by 999 on different lines            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5239_22238" name="resp5239_" type="radio" value="22238">        </td>
        <td class="c1 text ">
          <label for="resp5239_22238">
            <span class="anun">b<span class="anumsep">.</span></span> Prints 999 followed by 100 on different lines            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5239_22239" name="resp5239_" type="radio" value="22239">        </td>
        <td class="c1 text ">
          <label for="resp5239_22239">
            <span class="anun">c<span class="anumsep">.</span></span> Compilation error at line 4            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5239_22240" name="resp5239_" checked="checked" type="radio" value="22240">        </td>
        <td class="c1 text correct">
          <label for="resp5239_22240">
            <span class="anun">d<span class="anumsep">.</span></span> Compilation error at line 16            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice D is the correct answer.<br><br> Upon instantiation of MyClass on line 16, the compiler looks for a paramaterless constructor. As there is an overloaded constructor defined, the default constructor (with no arguments) will not be provided by the compiler. Since there is no matching constructor, the code does not compile here. <br><br>void MyClass() is a normal method and not a constructor since constructors do not have a return value. Since it is a legal method definition, there are no compiler errors at line 4. So choice C is incorrect. <br><br>Choices A and B are incorrect since the code does not compile.<br><br> To learn about constructors, refer to <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html">http://java.sun.com/docs/books/tutorial/java/javaOO/constructors.html</a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2011%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5421" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                11      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What will happen when you attempt to compile and run the following class?<br><br> class Base <br>{ <br>
<div style="margin-left: 40px;">Base(int i) <br>{ <br>
  <div style="margin-left: 40px;">System.out.println("Base"); <br></div>} <br></div>} <br><br>class Derived extends Base <br>{ <br>
<div style="margin-left: 40px;">public static void main(String[] argv) <br>{<br></div>
<div style="margin-left: 80px;"> Derived d = new Derived(); <br></div>
<div style="margin-left: 40px;">}<br> void Derived() <br>{<br></div>
<div style="margin-left: 80px;"> System.out.println("Derived"); <br></div>
<div style="margin-left: 40px;">} <br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5421_23096" name="resp5421_" type="radio" value="23096">        </td>
        <td class="c1 text ">
          <label for="resp5421_23096">
            <span class="anun">a<span class="anumsep">.</span></span> Compiles fine and prints "Derived" at runtime            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5421_23097" name="resp5421_" checked="checked" type="radio" value="23097">        </td>
        <td class="c1 text correct">
          <label for="resp5421_23097">
            <span class="anun">b<span class="anumsep">.</span></span> Compiler error            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5421_23098" name="resp5421_" type="radio" value="23098">        </td>
        <td class="c1 text ">
          <label for="resp5421_23098">
            <span class="anun">c<span class="anumsep">.</span></span> Compiles fine but no output is produced            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5421_23099" name="resp5421_" type="radio" value="23099">        </td>
        <td class="c1 text ">
          <label for="resp5421_23099">
            <span class="anun">d<span class="anumsep">.</span></span> Compiles fine and prints "Base" at runtime            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice B is the correct answer.<br><br> When an object of the Derived class is constructed in the main method, a super() call is automatically made by the constructor of the class. However, there is no matching constructor (no-args constructor) in the super class. So, the code causes a compiler error. <br><br>The compiler would have provided a default constructor, if no constructors had been written in the base class. However, in this case, the base class already defines a single argument constructor. So, no default constructor is provided. <br><br>Since the code does not compile, all the other choices are incorrect.      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2012%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q16322" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                12      </div>
      </div>
  <div class="content">
    <div class="qtext">
  Choose the option that will give the following output. <br>Book<br></div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp16322_62074" name="resp16322_" type="radio" value="62074">        </td>
        <td class="c1 text ">
          <label for="resp16322_62074">
            <span class="anun">a<span class="anumsep">.</span></span> enum Grade{A ,B, C, D};  <br> public class EnumTest{ <br> public static void main(String[] args){ <br> Grade grade= Grade.A; <br> switch(grade){  <br> case  A: System.out.println(grade); break; <br> default : System.out.println("Default"); } } }             <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp16322_62075" name="resp16322_" type="radio" value="62075">        </td>
        <td class="c1 text ">
          <label for="resp16322_62075">
            <span class="anun">b<span class="anumsep">.</span></span> class Grade{A {public String toString(){return "Book";}},B, C, D}; <br> public class EnumTest{ <br> public static void main(String[] args){ <br> Grade grade= Grade.A; <br> switch(grade){  <br> case  A: System.out.rintln(grade); break; <br> default : System.out.println("Default"); } } }             <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp16322_62076" name="resp16322_" type="radio" value="62076">        </td>
        <td class="c1 text correct">
          <label for="resp16322_62076">
            <span class="anun">c<span class="anumsep">.</span></span> enum Grade{A {public String toString(){return "Book";}},B, C, D}; <br> public class EnumTest{ <br> public static void main(String[] args){  <br> Grade grade= Grade.A; <br> switch(grade){ <br> case  A: System.out.println(grade); break; <br> default : System.out.println("Default"); } } }             <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp16322_62077" name="resp16322_" checked="checked" type="radio" value="62077">        </td>
        <td class="c1 text ">
          <label for="resp16322_62077">
            <span class="anun">d<span class="anumsep">.</span></span> enum Grade{A {public String toString(){return "Book";}},B, C, D}; <br> public class EnumTest{ <br> public static void main(String[] args){  <br> Grade grade= Grade.A; <br> switch(grade){ <br> case  Grade.A: System.out.println(grade); break; <br> default : System.out.println("Default"); } } }             <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Explanation:<br>Correct answer is choice C.<br><br>Enumerated types are declared using the enum keyword. <br><br>Here Grade is an enumerated type and A, B, and C are the values for that type. You can add methods to an Enum type just as you would add methods to a Java class. The toString() method on an enumerated type returns the name of the value. <br><br>In this case, the name given for the value A is "Book". The switch statement now supports the use of enum values. You must not prefix each enumerated type with the enum class name, in the case statement. So it is 'case A' and not 'case Grade.A'. Want to know more about enums? <br><br>Check out :<br><a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9" target="_blank">http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.9</a><br><br>      </div>
        <div class="grading">
      <div class="correctness  incorrect">Incorrect</div><div class="gradingdetails">Marks for this submission: 0/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2013%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5237" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                13      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What will be the result of compiling and executing the following code? <br><br>public static void main(String[] args) <br>{ <br><div style="margin-left: 40px;">int x = 10; <br>int y; <br>if (x &lt; 100) y = x / 0; <br>if (x &gt;= 100) y = x * 0; <br>System.out.println("The value of y is: " + y); <br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5237_22229" name="resp5237_" type="radio" value="22229">        </td>
        <td class="c1 text correct">
          <label for="resp5237_22229">
            <span class="anun">a<span class="anumsep">.</span></span> Compiler Error            <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5237_22230" name="resp5237_" type="radio" value="22230">        </td>
        <td class="c1 text ">
          <label for="resp5237_22230">
            <span class="anun">b<span class="anumsep">.</span></span> Prints "The value of y is: 0"            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5237_22231" name="resp5237_" checked="checked" type="radio" value="22231">        </td>
        <td class="c1 text ">
          <label for="resp5237_22231">
            <span class="anun">c<span class="anumsep">.</span></span> Throws ArithmeticException            <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5237_22232" name="resp5237_" type="radio" value="22232">        </td>
        <td class="c1 text ">
          <label for="resp5237_22232">
            <span class="anun">d<span class="anumsep">.</span></span> None of these            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice A is the correct answer. <br><br>The code will not compile raising an error that the local variable y might not have been initialized. Unlike member variables, local variables are not automatically initialized to the default values for their declared type. The compiler reports an error if you attempt to use a local variable which has not been initialized under every circumstances. Since the code does not compile, all the other choices are automatically incorrect.<br><br> For more information, refer to <a href="http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.12.5">http://java.sun.com/docs/books/jls/third_edition/html/typesValues.html#4.12.5</a>      </div>
        <div class="grading">
      <div class="correctness  incorrect">Incorrect</div><div class="gradingdetails">Marks for this submission: 0/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2014%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5489" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                14      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of compiling and running the following code? <br><br>public class EnumTest3<br>{ <br>
<div style="margin-left: 40px;">enum Employee<br>{ <br>
  <div style="margin-left: 40px;">MANAGER, CLERK, SECRETARY <br></div>} <br>public static void main(String[] argv)<br>{ <br>
  <div style="margin-left: 40px;">new EnumTest3(Employee.CLERK); <br></div>} <br>EnumTest3(Employee emp)<br>{ <br>
  <div style="margin-left: 40px;">switch (emp)<br>{ <br>
    <div style="margin-left: 40px;">case MANAGER: System.out.println("Manager"); <br>case CLERK: System.out.println("Clerk"); <br>case SECRETARY: System.out.println("Secretary"); <br></div>} <br></div>} <br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5489_23429" name="resp5489_" type="radio" value="23429">        </td>
        <td class="c1 text ">
          <label for="resp5489_23429">
            <span class="anun">a<span class="anumsep">.</span></span> Compiler error : case statements must use enum name as prefix for constants.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5489_23430" name="resp5489_" type="radio" value="23430">        </td>
        <td class="c1 text ">
          <label for="resp5489_23430">
            <span class="anun">b<span class="anumsep">.</span></span> Compiler error : missing semicolon in enum syntax.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5489_23431" name="resp5489_" checked="checked" type="radio" value="23431">        </td>
        <td class="c1 text correct">
          <label for="resp5489_23431">
            <span class="anun">c<span class="anumsep">.</span></span> Prints "Clerk" followed by "Secretary".            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5489_23432" name="resp5489_" type="radio" value="23432">        </td>
        <td class="c1 text ">
          <label for="resp5489_23432">
            <span class="anun">d<span class="anumsep">.</span></span> Prints "Clerk".            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice C is the correct answer. <br><br>Enumerated types are declared using the enum keyword. Here Employee is an enumeration type and MANAGER, CLERK and SECRETARY are values for that type. The switch statement now supports the use of enum values. <br><br>Since there are no break statements, the execution proceeds even after the matching case clause is encountered. So both "Clerk" and "Secretary" are printed. Thus choice C is correct and choice D is incorrect. <br><br>You must not preface each enumerated type with the enum class name, in the case statement. So choice A is incorrect. There are no errors in the enum syntax, so choice B is also incorrect. <br><br>Want to know more about enums? Refer to:<br><a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#%7C8.9">http://java.sun.com/docs/books/jls/third_edition/html/classes.html#|8.9</a> <br><a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html">http://java.sun.com/j2se/1.5.0/docs/guide/language/enums.html</a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2015%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5360" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                15      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of compiling and running the following code fragment? <br><br>String[][][] arr = { { {}, null }, <br>{ { "1", "2" }, <br>{ "1", null, "3" } },<br> {}, { { "1", null } }<br> };<br> System.out.println(arr.length + arr[1][2].length);</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5360_22812" name="resp5360_" checked="checked" type="radio" value="22812">        </td>
        <td class="c1 text correct">
          <label for="resp5360_22812">
            <span class="anun">a<span class="anumsep">.</span></span> The program will terminate with an ArrayIndexOutOfBoundsException.            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5360_22813" name="resp5360_" type="radio" value="22813">        </td>
        <td class="c1 text ">
          <label for="resp5360_22813">
            <span class="anun">b<span class="anumsep">.</span></span> The program will terminate with a NullPointerException.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5360_22814" name="resp5360_" type="radio" value="22814">        </td>
        <td class="c1 text ">
          <label for="resp5360_22814">
            <span class="anun">c<span class="anumsep">.</span></span> 4 will be written to standard output.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5360_22815" name="resp5360_" type="radio" value="22815">        </td>
        <td class="c1 text ">
          <label for="resp5360_22815">
            <span class="anun">d<span class="anumsep">.</span></span> 6 will be written to standard output.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5360_22816" name="resp5360_" type="radio" value="22816">        </td>
        <td class="c1 text ">
          <label for="resp5360_22816">
            <span class="anun">e<span class="anumsep">.</span></span> 7 will be written to standard output.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice A is the correct answer.<br><br> The expression arr.length will evaluate to 4. The expression arr[1] will access the element { { "1", "2" }, { "1", null, "3" } }, and arr[1][2] will try to access the third sub-element of this element. This produces an ArrayIndexOutOfBoundsException, since the element has only 2 sub-elements. Since an exception is thrown here, choices C, D and E are incorrect. <br><br>Choice B is incorrect since NullPointerException is not thrown here. <br><a href="http://www.whizlabs.com/examprep/mod/quiz/%20http://java.sun.com/docs/books/tutorial/java/data/multiarrays.html"><br></a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2016%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5223" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                16      </div>
      </div>
  <div class="content">
    <div class="qtext">
  Which of the following choices is the correct set of methods for getting and setting the value of a boolean property 'done' according to Java Bean naming standards? Select two choices.<br></div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose at least one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5223_22153" name="resp5223_22153" checked="checked" type="checkbox" value="22153">        </td>
        <td class="c1 text correct">
          <label for="resp5223_22153">
            <span class="anun">a<span class="anumsep">.</span></span> public void setDone(boolean done)  <br>&nbsp;&nbsp;&nbsp;&nbsp;public boolean getDone()            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5223_22154" name="resp5223_22154" checked="checked" type="checkbox" value="22154">        </td>
        <td class="c1 text correct">
          <label for="resp5223_22154">
            <span class="anun">b<span class="anumsep">.</span></span> public void setDone(boolean done)  <br>&nbsp;&nbsp;&nbsp;&nbsp;public boolean isDone()            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5223_22155" name="resp5223_22155" type="checkbox" value="22155">        </td>
        <td class="c1 text ">
          <label for="resp5223_22155">
            <span class="anun">c<span class="anumsep">.</span></span> public void setdone(boolean done)  <br>&nbsp;&nbsp;&nbsp;&nbsp;public boolean getdone()            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5223_22156" name="resp5223_22156" type="checkbox" value="22156">        </td>
        <td class="c1 text ">
          <label for="resp5223_22156">
            <span class="anun">d<span class="anumsep">.</span></span> public void setdone(boolean done)  <br>&nbsp;&nbsp;&nbsp;&nbsp;public boolean isdone()            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5223_22157" name="resp5223_22157" type="checkbox" value="22157">        </td>
        <td class="c1 text ">
          <label for="resp5223_22157">
            <span class="anun">e<span class="anumsep">.</span></span> public void getDone(boolean done)  <br>&nbsp;&nbsp;&nbsp;&nbsp;public boolean setDone()            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choices A and B are the correct answers. <br><br>According to the JavaBean naming standards, if the property name is 'x' and the type is Type, the accessor method is of the form: <br> public Type getX() <br>and the mutator method is of the form: <br> public void setX(Type newValue)<br><br> So choice A is correct. <br><br>For boolean properties, the accessor method can have the prefix 'is' or 'get'. So the following form is also allowed. <br> public boolean isX() <br> public void setX(boolean newValue) <br><br>So choice E is incorrect, while choice B is correct. <br><br>Please note that the starting letter of the property name is capitalized in the accessor and mutator methods. So choices C and D also incorrect.      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2017%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5209" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                17      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of compiling and running the following program? <br><br>class First<br>{ <br>
<div style="margin-left: 40px;">public Object method1() <br>{ <br>
  <div style="margin-left: 40px;">System.out.println("Calling super class method"); <br>return new String("Base"); <br></div>} <br></div>} <br><br>class Second extends First <br>{ <br>
<div style="margin-left: 40px;">public String method1() <br>{ <br>
  <div style="margin-left: 40px;">System.out.println("Calling sub class method"); <br>return new String("Derived"); <br></div>} <br></div>} <br><br>public class CovariantTest2 <br>{ <br>
<div style="margin-left: 40px;">public static void main(String[] args) <br>{ <br>
  <div style="margin-left: 40px;">First o = new Second(); <br>String s=o.method1(); <br>System.out.println(s); <br></div>} <br></div>}</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5209_22077" name="resp5209_" type="radio" value="22077">        </td>
        <td class="c1 text ">
          <label for="resp5209_22077">
            <span class="anun">a<span class="anumsep">.</span></span> Does not compile because the return type must be the same for the overriding method            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5209_22078" name="resp5209_" type="radio" value="22078">        </td>
        <td class="c1 text ">
          <label for="resp5209_22078">
            <span class="anun">b<span class="anumsep">.</span></span> Compiles but throws runtime exception            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5209_22079" name="resp5209_" type="radio" value="22079">        </td>
        <td class="c1 text ">
          <label for="resp5209_22079">
            <span class="anun">c<span class="anumsep">.</span></span> Prints "Base"            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5209_22080" name="resp5209_" type="radio" value="22080">        </td>
        <td class="c1 text ">
          <label for="resp5209_22080">
            <span class="anun">d<span class="anumsep">.</span></span> Prints "Derived"            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5209_22081" name="resp5209_" checked="checked" type="radio" value="22081">        </td>
        <td class="c1 text correct">
          <label for="resp5209_22081">
            <span class="anun">e<span class="anumsep">.</span></span> None of these            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice E is the correct answer. <br><br>This program does not compile, the reason is that the object reference used to invoke the method is of the super class type, so the return type must match the return type declared by the super class version of the method. Here the super class version declares Object as the return type, so you need to cast the result to the String type, when the method is invoked. <br><br>Choice A is incorrect because the covariant return types feature in Java allows a method in a subclass to return an object whose type is a subclass of the type returned by the method with the same signature in the super class. <br><br>Choices B, C, and D are incorrect since compilation fails, as explained above. <br><br>For more information, refer to <a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.5">http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.5</a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2018%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q16323" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                18      </div>
      </div>
  <div class="content">
    <div class="qtext">
  Choose the option that provides correct import statements for the following code:<br><br>public class Test<br>{public static void main(String[] args){<br>for(String s:args)<br>out.println(s);<br>}}<br></div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose at least one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp16323_62078" name="resp16323_62078" type="checkbox" value="62078">        </td>
        <td class="c1 text ">
          <label for="resp16323_62078">
            <span class="anun">a<span class="anumsep">.</span></span> static import java.lang.System.out;            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp16323_62079" name="resp16323_62079" type="checkbox" value="62079">        </td>
        <td class="c1 text ">
          <label for="resp16323_62079">
            <span class="anun">b<span class="anumsep">.</span></span> static import java.lang.System.*;             <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp16323_62080" name="resp16323_62080" checked="checked" type="checkbox" value="62080">        </td>
        <td class="c1 text ">
          <label for="resp16323_62080">
            <span class="anun">c<span class="anumsep">.</span></span> import static java.lang.System;             <img src="./Basic Stuff Sucks_files/cross_red_big.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp16323_62081" name="resp16323_62081" type="checkbox" value="62081">        </td>
        <td class="c1 text correct">
          <label for="resp16323_62081">
            <span class="anun">d<span class="anumsep">.</span></span>  import static java.lang.System.out;            <img src="./Basic Stuff Sucks_files/tick_green_small.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp16323_62082" name="resp16323_62082" checked="checked" type="checkbox" value="62082">        </td>
        <td class="c1 text correct">
          <label for="resp16323_62082">
            <span class="anun">e<span class="anumsep">.</span></span> import static java.lang.System.*;             <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Explanation:<br>Correct answer are choice D and E.<br><br>To be able to use the System.out.println by simply mentioning out.println, the static out variable in the System class needs to be imported using static imports. However, the println method cannot be imported this way, since it is not static. Also, the System class cannot be imported by static import.<br><br>To know more about static imports, refer to <br><a href="http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.3" target="_blank">http://java.sun.com/docs/books/jls/third_edition/html/packages.html#7.5.3 </a>      </div>
        <div class="grading">
      <div class="correctness  partiallycorrect">Partially correct</div><div class="gradingdetails">Marks for this submission: 0.5/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2019%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5423" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                19      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What is the result of attempting to compile and run the following code?<br><br> abstract class SuperTest <br>{ <br>
<div style="margin-left: 40px;">static int i=10; <br></div>}<br> class Test extends SuperTest implements Inter <br>{ <br>
<div style="margin-left: 40px;">final static int i; <br>static { i=9; } <br>void f() <br>{<br>
  <div style="margin-left: 40px;"> System.out.println("i is "+i); <br></div>}<br> public static void main(String[] args) <br>{ <br>
  <div style="margin-left: 40px;">Inter t = new Test(); <br>t.f(); <br></div>} <br></div>}<br> interface Inter <br>{ <br>
<div style="margin-left: 40px;">int i= 1; <br>void f();<br></div> }<br></div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5423_23104" name="resp5423_" type="radio" value="23104">        </td>
        <td class="c1 text ">
          <label for="resp5423_23104">
            <span class="anun">a<span class="anumsep">.</span></span> Code does not compile because you cannot extend a class and implement an interface at the same time.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5423_23105" name="resp5423_" type="radio" value="23105">        </td>
        <td class="c1 text ">
          <label for="resp5423_23105">
            <span class="anun">b<span class="anumsep">.</span></span> Code does not compile because SuperTest does not contain any abstract methods.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5423_23106" name="resp5423_" type="radio" value="23106">        </td>
        <td class="c1 text ">
          <label for="resp5423_23106">
            <span class="anun">c<span class="anumsep">.</span></span> Code does not compile because a final static variable cannot be initialized in a static block.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5423_23107" name="resp5423_" type="radio" value="23107">        </td>
        <td class="c1 text ">
          <label for="resp5423_23107">
            <span class="anun">d<span class="anumsep">.</span></span> Code compiles and prints 9.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5423_23108" name="resp5423_" type="radio" value="23108">        </td>
        <td class="c1 text ">
          <label for="resp5423_23108">
            <span class="anun">e<span class="anumsep">.</span></span> Code compiles and prints 1.            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5423_23109" name="resp5423_" checked="checked" type="radio" value="23109">        </td>
        <td class="c1 text correct">
          <label for="resp5423_23109">
            <span class="anun">f<span class="anumsep">.</span></span> None of the above.            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice F is the correct answer. <br><br>The code does not compile, but not because of any of the given reasons. As you know, interface methods are implicitly public. <br><br>When you implement the method in your class, you have to declare the method as public too otherwise you are violating the overriding rule which states that the overriding method cannot have weaker access privileges than the overridden method. Here if you make the f() method public in the Test class, it compiles fine and prints 9. <br><br>Choice A is incorrect because you can extend a class and implement an interface at the same time. <br><br>Choice B is incorrect because an abstract class need not have any abstract methods. <br><br>Choice C is incorrect because a final static variable can be initialized at the time of declaration or in a static block. <a href="http://java.sun.com/docs/books/tutorial/java/interpack/createinterface.html"><br></a>      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>
<div style="float:left"><a href="mailto:support@whizlabs.com?subject=Feedback%20to%20author%20for%20Question%2020%20of%20Quiz%20Basic%20Stuff%20Sucks%20(ID:%202105),%20Course%20ID:%2011">Feedback to Author</a></div><div id="q5308" class="que multichoice clearfix">
  <div class="info">
    <span class="no"><span class="accesshide">Question </span></span>
          <div class="grade">
                20      </div>
      </div>
  <div class="content">
    <div class="qtext">
  What will be the result of compiling and running the following code?<br><br> import java.util.*;<br> public class Test <br>{<br>
<div style="margin-left: 40px;"> public abstract class InnerTest <br>{<br>
  <div style="margin-left: 40px;"> abstract void f();<br></div> }<br> public static void main(String[] args)<br> { <br>
  <div style="margin-left: 40px;">Test t=new Test(); <br>Test.InnerTest test=t.new InnerTest() <br>{ <br>
    <div style="margin-left: 40px;">public void f()<br> {<br>
      <div style="margin-left: 40px;">System.out.println("Inner f"); <br></div>} <br></div>}<br></div> }<br></div> }</div>


<div class="ablock clearfix">
  <div class="prompt">
    Choose one answer.  </div>

  <table class="answer">
          <tbody><tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5308_22574" name="resp5308_" type="radio" value="22574">        </td>
        <td class="c1 text ">
          <label for="resp5308_22574">
            <span class="anun">a<span class="anumsep">.</span></span> Does not compile            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5308_22575" name="resp5308_" type="radio" value="22575">        </td>
        <td class="c1 text ">
          <label for="resp5308_22575">
            <span class="anun">b<span class="anumsep">.</span></span> Prints "Inner f"            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5308_22576" name="resp5308_" type="radio" value="22576">        </td>
        <td class="c1 text ">
          <label for="resp5308_22576">
            <span class="anun">c<span class="anumsep">.</span></span> Throws an exception at runtime            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r1">
        <td class="c0 control">
          <input disabled="disabled" id="resp5308_22577" name="resp5308_" checked="checked" type="radio" value="22577">        </td>
        <td class="c1 text correct">
          <label for="resp5308_22577">
            <span class="anun">d<span class="anumsep">.</span></span> Compiles and runs, but produces no output            <img src="./Basic Stuff Sucks_files/tick_green_big.gif" alt="Correct" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
          <tr class="r0">
        <td class="c0 control">
          <input disabled="disabled" id="resp5308_22578" name="resp5308_" type="radio" value="22578">        </td>
        <td class="c1 text ">
          <label for="resp5308_22578">
            <span class="anun">e<span class="anumsep">.</span></span> None of the above            <img src="./Basic Stuff Sucks_files/cross_red_small.gif" alt="Incorrect" class="icon">          </label>
        </td>
        <td class="c0 feedback">
                  </td>
      </tr>
      </tbody></table>
    </div>
      <div class="generalfeedback">
        Choice D is the correct answer.<br><br> This code compiles fine as it is allowed to declare an inner class as abstract. Note that you can only instantiate concrete subclasses of the abstract inner class. Here, the concrete anonymous subclass of the InnerTest class implements the f() method, so we can instantiate the subclass. However, there is no output produced since the f() method is not invoked anywhere.      </div>
        <div class="grading">
      <div class="correctness  correct">Correct</div><div class="gradingdetails">Marks for this submission: 1/1.</div>    </div>  </div>
</div>

<div class="controls">
<div class="singlebutton"><form action="http://www.whizlabs.com/examprep/mod/quiz/view.php" method="get"><div><input type="hidden" name="id" value="2545"><input type="submit" value="Finish review"></div></form></div></div>
<!--Start - Display Buttons with their course prices in each moodle pages: Devesh M-->
				
		<!--Start - Display Buy Mock Exam Full Version button with price at trial course page only: Devesh M-->
				<!--End - Display Buy Mock Exam Full Version button with price at trial course page only: Devesh M-->
  <div id="leftfooter" style="display: none; "></div><div id="rightfooter" style="display: none; "><p class="footertopma">Thanks Whizlabs for such an excellent product. It really helped me a lot for my achivement. -Nazmul<span class="more"><a href="http://www.whizlabs.com/examprep/mod/quiz/review.php?attempt=170040&showall=true#" class="amore"> more</a></span></p>

  </div>

  <div id="rightfooter2" style="display: none; "><p class="copyright">Whizlabs Copyright (C) 2011. All Rights Reserved.</p></div>
<script language="javascript">
	if(document.getElementById("left-column")) {
	
	}
	else {
		document.getElementById('leftfooter').style.display='none';
		document.getElementById('rightfooter').style.display='none';
		document.getElementById('rightfooter2').style.display='none';
	}
</script>
  <div id="footerbottom">
    
 <center>
	<div style="border:0px solid #FFFFFF; font-size:11px; font-family:Arial, Helvetica, sans-serif; font-weight:bold; color:#000;">
		<br>
		<span><a href="http://www.whizlabs.com/scja/scja.html" title="SCJA Certification" style="text-decoration:none; color:#000;">SCJA Certification</a></span> |
		<span><a href="http://www.whizlabs.com/scjp/scjp.html" title="SCJP Certification" style="text-decoration:none; color:#000;">SCJP Certification</a></span> |
		<span><a href="http://www.whizlabs.com/scwcd/scwcd.html" title="SCWCD Certification" style="text-decoration:none; color:#000;">SCWCD Certification</a></span> |
		<span><a href="http://www.whizlabs.com/scbcd/scbcd.html" title="SCBCD Certification" style="text-decoration:none; color:#000;">SCBCD Certification</a></span> |
		<span><a href="http://www.whizlabs.com/scdjws/scdjws.html" title="SCDJWS Certification" style="text-decoration:none; color:#000;">SCDJWS Certification</a></span> |
		<span><a href="http://www.whizlabs.com/scmad/scmad.html" title="SCMAD Certification" style="text-decoration:none; color:#000;">SCMAD Certification</a></span> |
		<span><a href="http://www.whizlabs.com/scea/scea.html" title="SCEA Certification" style="text-decoration:none; color:#000;">SCEA Certification</a></span>

		<br><br>
		<span><a href="http://www.whizlabs.com/otherpages/legal.html" alt="coming soon" style="text-decoration:none; color:#000;">Legal</a></span> |
		<span><a href="http://www.whizlabs.com/otherpages/policies.html" alt="coming soon" style="text-decoration:none; color:#000;">Policies</a></span> |
		<span><a href="http://www.whizlabs.com/otherpages/copyrights-and-trademarks.html" alt="coming soon" style="text-decoration:none; color:#000;"> Copyrights and Trademarks</a></span>
	</div>
	<br>
</center>
</div>
 </div>

<!--End - Display Buttons with their course prices in each moodle pages: Devesh M-->
<!--Footer links for each moodle pages-->


<!--Google Adwords Code Start: Devesh M-->
	<!--quiz/review.php--> 
	<!-- Google Code for Trial Test Reviewed Conversion Page --> 
	<script type="text/javascript">
	<!--
	var google_conversion_id = 1071861065;
	var google_conversion_language = "en";
	var google_conversion_format = "2";
	var google_conversion_color = "ffffff";
	var google_conversion_label = "YhFjCNjMogEQyZqN_wM"; var google_conversion_value = 0; //--> </script> <script type="text/javascript" src="./Basic Stuff Sucks_files/conversion.js">
	</script><iframe name="google_conversion_frame" width="200" height="26" src="./Basic Stuff Sucks_files/saved_resource.htm" frameborder="0" marginwidth="0" marginheight="0" vspace="0" hspace="0" allowtransparency="true" scrolling="no">&lt;img height="1" width="1" border="0" src="http://www.googleadservices.com/pagead/conversion/1071861065/?frame=0&amp;random=1323730729970&amp;cv=7&amp;fst=1323730729970&amp;num=1&amp;fmt=2&amp;value=0&amp;label=YhFjCNjMogEQyZqN_wM&amp;bg=ffffff&amp;hl=en&amp;guid=ON&amp;u_h=1080&amp;u_w=1920&amp;u_ah=1080&amp;u_aw=1920&amp;u_cd=32&amp;u_his=18&amp;u_tz=-120&amp;u_java=true&amp;u_nplug=27&amp;u_nmime=117&amp;ref=http%3A//www.whizlabs.com/examprep/mod/quiz/review.php%3Fattempt%3D170040&amp;url=http%3A//www.whizlabs.com/examprep/mod/quiz/review.php%3Fattempt%3D170040%26showall%3Dtrue" /&gt;</iframe>
	<noscript>
	&lt;div style="display:inline;"&gt;
	&lt;img height="1" width="1" style="border-style:none;" alt=""
	src="http://www.googleadservices.com/pagead/conversion/1071861065/?label=YhF
	jCNjMogEQyZqN_wM&amp;amp;guid=ON&amp;amp;script=0"/&gt;
	&lt;/div&gt;
	</noscript>
<!--Google Adwords Code End : Devesh M-->

<!--OnTarget Code Start: Devesh M-->
<script language="JavaScript">
	var s_PageName = "OCPJP 6 - Exam Simulator: Basic Stuff Sucks";

			</script>

<!--End of OnTarget Code: Devesh M-->

<!-- Start of Google Analytics Code: Devesh M-->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script><script src="./Basic Stuff Sucks_files/ga.js" type="text/javascript"></script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-320509-1");
pageTracker._trackPageview();
} catch(err) {}</script>
<!--End of Google Analytics Code: Devesh M-->



</body><span id="skype_highlighting_settings" display="none" autoextractnumbers="1"></span><object id="skype_plugin_object" location.href="http://www.whizlabs.com/examprep/mod/quiz/review.php?attempt=170040&amp;showall=true" location.hostname="www.whizlabs.com" style="position: absolute; visibility: hidden; left: -100px; top: -100px; " width="0" height="0" type="application/x-vnd.skype.click2call.chrome.5.6.0"></object></html>